package com.kq.myofficialaccount.utils;
import java.util.Random;
public class TokenUtil {

        public static String generateShortToken() {
            // 可以选择包含的字符集合
            String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

            // 创建Random对象
            Random random = new Random();

            // 生成6位的随机标识符
            StringBuilder tokenBuilder = new StringBuilder();
            for (int i = 0; i < 6; i++) {
                // 从字符集合中随机选择一个字符
                char randomChar = characters.charAt(random.nextInt(characters.length()));
                tokenBuilder.append(randomChar);
            }
            return tokenBuilder.toString();
        }
    }


